home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3122 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: sourcery.han.de!not-for-mail
  2. Newsgroups: comp.sys.amiga.programmer
  3. References: <311cf9aa@beachyhd.demon.co.uk>
  4. From: "Olaf Barthel" <olsen@sourcery.han.de>
  5. Date: Mon, 12 Feb 1996 15:01:42 +0100
  6. X-NewsReader: IntuiNews 1.3a (7.9.95)
  7. Subject: Re: SetRGB32() doesn't do what it should..
  8. Message-ID: <13213605@sourcery.han.de>
  9.  
  10. In Article <311cf9aa@beachyhd.demon.co.uk>, Adam <Adam@beachyhd.demon.co.uk> wrote:
  11. > In a message of 07 Feb 96 Robby Paehlig wrote to All:
  12. >
  13. >  RP> Here are some lines, that should change color 8 of my Workbench to
  14. >  RP> blue:
  15. >
  16. >  RP> [...]
  17. >  RP> if(GfxBase = (struct GfxBase *)(OpenLibrary("graphics.library", 39L)))
  18. >  RP> {
  19. >  RP>     if(wb = LockPubScreen("Workbench")) {
  20. >  RP>         SetRGB32(&(wb->ViewPort), 8, 0x0ul, 0x0ul, 0xFFul);
  21. >  RP> [...]
  22. >
  23. >  RP> Well, the color changes -- not to blue, but to black! What I'm doing
  24. >  RP> wrong?
  25. >
  26. > You need to specify the colours as a "32 bit left justified fraction". What
  27. > this basically means is that bits 24-31 are the bits to use for 8-bit colour.
  28. > To set your colour to blue, try this:
  29. >
  30. >     SetRGB32(&(wb->ViewPort), 8, 0x00000000, 0x00000000, 0xFF000000);
  31.  
  32.    Not exactly correct. This should read
  33.  
  34.       SetRGB32(&(wb->ViewPort), 8, 0x00000000, 0x00000000, 0xFFFFFFFF);
  35.  
  36.    Here is a simple 24->96 bit conversion routine:
  37.  
  38.    VOID
  39.    SetRGB8(struct ViewPort *vp,LONG index,LONG r,LONG g,LONG b)
  40.    {
  41.        SetRGB32(vp,index,r * 0x01010101,g * 0x01010101,b * 0x01010101);
  42.    }
  43.  
  44. --
  45. Home: Olaf Barthel, Brabeckstrasse 35, D-30559 Hannover
  46.  Net: olsen@sourcery.han.de
  47.